package com.spring.gateway.filter.befor;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 前置过滤器
 *
 * @author xiangtianlei
 * @date 2023/12/20
 */
@Component
public class BeforeFilter implements GlobalFilter, Ordered {
    public BeforeFilter() {
    }

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        System.out.println("前置通知");
        return chain.filter(exchange);
    }

    @Override
    public int getOrder() {
        return 1;
    }
}
